﻿@using ProjectManagement.Models
@{
    ViewBag.Title = "Country";
}
@(Html.Telerik().Grid<_Country>()
    .Name("Country")
    .DataKeys(keys => { keys.Add(item => item.ID); })
    .ToolBar(toolBar => toolBar.Template(
                @<text> 国家表： <a class="t-button t-grid-add" href="/Country?Country-mode=insert">新增记录</a>
</text>
                ))
        .DataBinding(dataBinding =>
        {
            dataBinding.Ajax()
            .Select("_SelectIndex", "Country")
            .Insert("_InsertAjaxEditing", "Country")
            .Update("_SaveAjaxEditing", "Country")
            .Delete("_DeleteAjaxEditing", "Country");
        })
            .Columns(columns =>
            {
                columns.Bound(item => item.Name).Width(240);
                columns.Command(commands =>
                {
                    commands.Edit();
                    commands.Delete();
                }).Title("操作").Width(200);
            }).Resizable(r => r.Columns(true))
            .DetailView(view => view.ClientTemplate(
                Html.Telerik().TabStrip()
                    .Name("TabStrip_<#= ID #>")
                    .SelectedIndex(0)
                    .Items(items =>
                    {
                        items.Add().Text("城市").HtmlAttributes(new { style = "width:90px;text-align: center" }).Content(
                            Html.Telerik().Grid<_City>()
                                .Name("City_<#= ID #>")
                                .DataKeys(keys => { keys.Add(item => item.ID); })
                                .ClientEvents(events => events.OnEdit("onEdit"))
                                .ToolBar(toolBar => toolBar.Template(
                                    @<text> <a class="t-button t-grid-add" href="/City?City-mode=insert">新增记录</a>
</text>
                                    ))
                                .DataBinding(dataBinding =>
                                {
                                    dataBinding.Ajax()
                                        .Select("_SelectIndex", "City", new { conferenceid = "<#= ID #>" })
                                        .Insert("_InsertAjaxEditing", "City", new { conferenceid = "<#= ID #>" })
                                        .Update("_SaveAjaxEditing", "City", new { conferenceid = "<#= ID #>" })
                                        .Delete("_DeleteAjaxEditing", "City", new { conferenceid = "<#= ID #>" });
                                })
                                .Columns(columns =>
                                {
                                    columns.Bound(item => item.Name).Width(240);
                                    columns.Command(commands =>
                                    {
                                        commands.Edit();
                                        commands.Delete();
                                    }).Title("操作").Width(200);
                                })
                                .Editable(editing => editing.Mode(GridEditMode.PopUp))
                                .Pageable(paging => paging.Style(GridPagerStyles.Status).PageOnScroll(true))
                                .Scrollable()
                                .Sortable()
                                .ToHtmlString()

                            );
                    })
                            .ToHtmlString()
                    ))
            .Editable(editing => editing.Mode(GridEditMode.PopUp))
            .Pageable(paging => paging.Style(GridPagerStyles.Status).PageOnScroll(true))
            .Scrollable(c => c.Height("570px"))
    .Resizable(resizing => resizing.Columns(true))
            .Sortable()
        )
<script type="text/javascript">

    function onEdit(e) {

    }


</script>
